<?php
/**********************************INCLUDE*********************************** *
* **************************************************************************** */
include_once '../app/App.php';
include_once '../db/DatabaseManager.php';

/**
 * @author nicholas malacarne <nicholas.malacarne@gmail.com>
 * 
 * This script is used to register an account.
 */

// required GET data fields -nm
$required = array( 'username', 'password', 'email' );

try {
    
    // check if we have required parameters -nm
    if ( ! App::paramOK( $required, $_GET ) ){
        
        throw new ErrorException( "Error Processing Parameters !" );
    }
    
    $data = array( 'username' => FALSE, 'password' => FALSE, 'email' => FALSE );
    
    echo json_encode( array( "invalid" => $data ) );
    
    // TODO: register account -nm
    
}catch( Exception $e ){
    
    $report[ 'exception' ] = array();
    
    $report[ 'exception' ][ 'file' ] = $e->getFile();
    $report[ 'exception' ][ 'line' ] = $e->getLine();
    $report[ 'exception' ][ 'msg' ] = $e->getMessage();
    
    echo json_encode( $report );
    
} // TODO: handle specific exception -nm

exit();